// ignore_for_file: constant_identifier_names

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

const Color_Main = Color(0xFF00CBD0);
const Color_Main_hot = Color(0xFFFFDB4D);
const Color_Main14 = Color(0x1400CBD0);
const Color_Main84 = Color(0x8400CBD0);
const Color_0 = Color(0xFF000000);
const Color_50_0 = Color(0x50000000);
const Color_F = Color(0xFFFFFFFF);
const Color_50F = Color(0x50FFFFFF);
const Color_999 = Color(0xFF999999);
const Color_F8E4C6 = Color(0xFFF8E4C6);
const Color_FFD09B = Color(0xFFFFD09B);
const Color_FF8A00 = Color(0xFFFF8A00);
const Color_FFF8DE = Color(0xFFFFF8DE);
const Color_333 = Color(0xFF333333);
const Color_BEA = Color(0xFFE7EBEA);
const Color_22B = Color(0xFFED622B);
const Color_6E7 = Color(0xFF4786E7);
const Color_3081 = Color(0xFF3081FF);
const Color_061 = Color(0xFF48B061);
const Color_868 = Color(0xFF686868);
const Color_DF = Color(0xFFDFDFDF);
const Color_F2F8 = Color(0xFFF2F8F8);
const Color_B3B2 = Color(0xFFAAB3B2);
const Color_CB9 = Color(0xFFFFDCB9);
const Color_200 = Color(0xFFA98200);
const Color_FD2 = Color(0xFF00CFD2);
const Color_0DE = Color(0xFFC7D0DE);
const Color_666 = Color(0xFF666666);
const Color_FF00 = Color(0xFFFF0000);
const Color_F91010 = Color(0xFFF91010);
const Color_CC = Color(0xFFCCCCCC);
const Color_F8F8 = Color(0xFFF8F8F8);
const Color_Line = Color(0xFFE6ECEA);
const Color_F6F6F6 = Color(0xFFF6F6F6);
const Color_462 = Color(0xFFFF6462);
const Color_04C = Color(0xFFF5904C);
const Color_C54 = Color(0xFFFFBC54);
const Color_00B8BD = Color(0xFF00B8BD);
const Color_747474 = Color(0xFF747474);
const Color_FF8E36 = Color(0xFFFF8E36);
const Color_F5FAFB = Color(0xFFF5FAFB);
const Color_FF5A36 = Color(0xFFFF5A36);
const Color_DFDFDF = Color(0xFFDFDFDF);
const Color_F2F4F6 = Color(0xFFF2F4F6);
const Color_D7F3FA = Color(0xFFD7F3FA);
const Color_9AE4F1 = Color(0xFF9AE4F1);
const Color_80E7E9 = Color(0xFF80E7E9);
const Color_F3F3 = Color(0xFFF3F3F3);
const Color_F9F9 = Color(0xFFF9F9F9);
const Color_EBEB = Color(0xFFEBEBEB);
const Color_FF2424 = Color(0xFFFF2424);
const Color_Firm = [
  Color(0xFFFF6B2C),
  Color(0xFF4AB2FB),
  Color(0xFF537CF9),
  Color(0xFF00CBD0),
  Color(0xFFFFA24C),
  Color(0xFFEE5D5C),
  Color(0xFF784AFB),
];


Color? hexToColor(String code) {
  if (code.isEmpty || !code.startsWith("#")) {
    return null;
  }
  try {
    return Color(
        int.parse(code.substring(1, code.length), radix: 16) + 0xFF000000);
  } catch (e) {
    return null;
  }
}

ThemeData theme = ThemeData(
  colorScheme:
      ColorScheme.fromSeed(seedColor: Color_Main, secondary: Color_Main),
  // useMaterial3: true,
  primaryColor: Color_Main,
  //cursorColor 光标颜色
  textSelectionTheme: const TextSelectionThemeData(cursorColor: Color_Main),
  primaryIconTheme: const IconThemeData(
    color: Color_Main,
  ),
  focusColor: Color_Main,
  //单选未选中颜色
  unselectedWidgetColor: Color_BEA,
  inputDecorationTheme: const InputDecorationTheme(
    border: InputBorder.none,
  ),
  appBarTheme: appBarTheme(),
  bottomNavigationBarTheme: bottomNavigationBarTheme(),
  textTheme: textTheme,
  scaffoldBackgroundColor: Colors.white,
  navigationBarTheme: bottomNavigationTheme(),
);

TextTheme textTheme = TextTheme(
    // displayLarge: TextStyle(),
    // displayMedium: TextStyle(),
    // displaySmall: TextStyle(),
    // headlineLarge: TextStyle(),
    // headlineMedium: TextStyle(),
    // headlineSmall: TextStyle(),
    // titleLarge: TextStyle(),
    // titleMedium: TextStyle(),
    // titleSmall: TextStyle(),
    // bodyLarge: TextStyle(),
    // bodyMedium: TextStyle(),
    // bodySmall: TextStyle(),
    // labelLarge: TextStyle(),
    // labelMedium: TextStyle(),
    // labelSmall: TextStyle(),
    );

AppBarTheme appBarTheme() {
  return const AppBarTheme(
    toolbarHeight: 48,
    backgroundColor: Color_F,
    elevation: 0,
    centerTitle: true,
    titleTextStyle: TextStyle(
      fontSize: 18,
      color: Color_333,
    ),
    iconTheme: IconThemeData(color: Color_333),
    actionsIconTheme: IconThemeData(color: Color_333),
  );
}

BottomNavigationBarThemeData bottomNavigationBarTheme() {
  return const BottomNavigationBarThemeData(
    backgroundColor: Color_F,
    elevation: 4.0,
    selectedItemColor: Color_Main,
    unselectedItemColor: Color(0xFFB0B0B0),
    selectedLabelStyle: TextStyle(
      // color: Color_Main,
      fontSize: 12,
    ),
    unselectedLabelStyle: TextStyle(
      // color: Color(0xFFB0B0B0),
      fontSize: 12,
    ),
    selectedIconTheme: IconThemeData(
      size: 24,
    ),
    type: BottomNavigationBarType.fixed,
  );
}

NavigationBarThemeData bottomNavigationTheme() {
  return const NavigationBarThemeData(
    backgroundColor: Colors.transparent,
  );
}
